package cn.tedu.thread;
///测试 Thread类
public class Test2_Thread {
    public static void main(String[] args) {
//        Thread thread = new Thread();
        MyThread t = new MyThread();
        MyThread t2 = new MyThread();
//        t.run();
        t.setName("线程1");
        t.start();//开启线程的唯一方法
//        t2.run();
        t2.setName("线程2");
        t2.start();
    }
}
class MyThread extends Thread{
    @Override
    public void run() {

        for (int i = 0; i < 10; i++) {
            System.out.println(getId()+getName()+"---"+i);
        }
    }
}